<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
/***********************************************
* 파일명   	: common_code.jsp
* 기  능      	: 공통코드 관리
* 최초 작성일 	: 2009/02/10
* @author 	: Yang D
*************************************************
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<s:head theme="ajax" />
	<script src="/inc/js/aa.js"></script>
	<meta http-equiv="Content-Type" 	content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" 			content="no-cache" />
	<meta http-equiv="cache-control" 	content="no-cache" />
	<meta http-equiv="expires" 			content="0" />
	<title>공통코드 관리</title>
	
	<!-- ============================== J A V A S C R I P T		S T  A R T ============================== -->
	<script type="text/javascript">
		//체크된 것인지 확인하기 위한 플래그.
		var flag	=	false;
		
		//조회
		function fnc_retrieve(f) {
			fnc_dojo_publish();
			return false;
		}
		
		//대표코드 추가
		function fnc_group_add_on_p() {
			
			var uri		=	"common_code_primary_p.action";
			var	nm		=	"pre_code";
			var attr    =   "width=300 , height=200 , status=no";   //window size
			
			window.open(uri , nm , attr);
			
			return false;
		}
		
		//하위코드 추가
		function fnc_sub_add_on_p() {
			
			var uri		=	"common_code_sub_p.action";
			var	nm		=	"sub_code";
			var attr    =   "width=300 , height=200 , status=no";   //window size
			
			window.open(uri , nm , attr);
			
			return false;
		}
		
		//코드 삭제
		function fnc_delete(f) {
			if(!fnc_chk_validate(f)) {
				return false;
			}
			
			if(!confirm("<s:text name="alert.message.questionDelete" />")) {
				alert("<s:text name="alert.message.cancel" />");
				return false;
			} 

			f.action	=	"";
			f.submit();
			
			return false;
		}
		
		//체크되었는지 확인함.
		function fnc_chk_validate(f) {
			for (var i = 0 ; i < f.s_chk.length ; i++) {
				if(!f.s_chk[i].checked) {
					continue;
				} else {
					flag = true;
				}
			}
			
			if (!flag) {
				alert("<s:text name="alert.message.requiedCheck" />");
				f.s_chk[0].focus();
				return flag;
			}
			
			return flag;
		}
		
		function fnc_dojo_publish() {
			dojo.event.topic.publish("ajax_list");
		}
		
		//대표코드 수정
		//group_cd	-	대표코드
		//cd_no		-	하위코드
		function fnc_mod_high_code(group_cd , cd_no) {
			//alert(high_cd + "\r\n" + cd);
			var uri		=	"common_code_primary_p.action";
			var	nm		=	"mod_high_cd";
			var attr    =   "width=300 , height=200 , status=no";   //window size
			
			uri			+=	"?" + "group_cd=" + group_cd + "&" + "cd_no=" + cd_no;
			alert(uri);					//debug
			
			window.open(uri , nm , attr);
		}
		//하위코드 수정
		//group_cd	-	대표코드
		//cd_no		-	하위코드
		function fnc_mod_sub_code(group_cd , cd_no) {
			//alert(high_cd + "\r\n" + cd);
			var uri		=	"common_code_sub_p.action";
			var	nm		=	"mod_high_cd";
			var attr    =   "width=300 , height=200 , status=no";   //window size
			
			uri			+=	"?" + "group_cd=" + group_cd + "&" + "cd_no=" + cd_no;
			alert(uri);					//debug
			
			window.open(uri , nm , attr);
		}
	</script>
	<!-- ============================== J A V A S C R I P T 	E	N	D ============================== -->
</head>
<!-- ============================== BODY START ============================== -->
<body>
	<div class="fl_ri">
		<div id="contants_box">
		<div id="tit">  
			<span class="fl_ri tit_navi"><a href="/" >Home</a> &gt; 관리자 &gt; <span class="f_b">공통코드관리</span></span>
			<div class="fl_le"><img src="/images/tit_menu05_img05.gif" /></div>
		</div>
		<s:form name="frm" id="frm" theme="simple" method="post" onsubmit="return false">
			<s:hidden id="cur_page" name="cur_page"/>
			<!-- -------------------------------------	C O N D I T I O N 	S T A R T------------------------------------- -->
			<div id="search03">
				<div id="search_box03">
					<ul>
						<li class="txt">대표코드명</li>
						<li class="input">
							<s:select name="group_cd" list="listGroupCode" headerKey="ALL" headerValue="::전체::" listKey="cd" listValue="cd_nm" cssClass="combobox100se" />
						</li>
						<li class="txt01">코드명</li>
						<li class="input">
							<s:textfield id="cd_nm" name="cd_nm" cssClass="input_120se" />
						</li>
					</ul>
				<!-- -------------------------------------	C O N D I T I O N 	E	N	D------------------------------------- -->
				<!-- -------------------------------------	B U T T O N 	S T A R T------------------------------------- -->
				<ul class="btn">
					<li>
						<span id="cebtn">
							<img src="/images/btn_search03.gif"	title="조회" 		class="img_tm"	style="cursor: pointer;" 	onclick="return fnc_retrieve()" />
							<img src="/images/btn_add02.gif" 	title="대표코드 추가"	class="img_tm" 	style="cursor: pointer;"  	onclick="return fnc_group_add_on_p()" />
							<s:submit type="image" src="/images/btn_cdd.gif" 	value="코드 삭제" 		title="코드 삭제" 	cssClass="img_tm"  	onclick="return fnc_delete(this.form)" />
						</span>
					</li>
				</ul>
				<!-- -------------------------------------	B U T T O N 	E	N	D------------------------------------- -->
			   </div>
			</div>
				<!-- ajax로 데이터를 조회해 온다. -->
		<s:url id="ajax_list"  action="common_code_list_ajax" />
		<s:div id="itemAmtlistDiv" theme="ajax" executeScripts="true" showLoadingText="false" href="%{ajax_list}" listenTopics="ajax_list" formId="frm" />
		</s:form>
		</div>
	</div>
</body>
<!-- ============================== BODY END ============================== -->
</html>